<?php
	//echo '<PRE>'; print_r($_SERVER); exit;
	
	if($_SERVER['PHP_SELF'] == '/limitless/index.php'){
		exit('/limitless/bs4/Template/');
	}
	
	$filePath = str_replace("D:\\home\\WWW", "D:\\home\\WWW\\limitless", $_SERVER['PATH_TRANSLATED']);
	$fileUrl = 'http://demo.interface.club/'.$_SERVER['REQUEST_URI'];
	if(is_dir($filePath)){
		exit(sprintf('%s is a dir.', $filePath));
	}
	$fileBase = dirname($filePath);

	if(!is_dir($fileBase)) {
	    @unlink($fileBase);
        mkdir($fileBase, 0777, true);
    }

	//echo $fileUrl;
	$content = file_get_contents($fileUrl);
	$res = file_put_contents($filePath, $content);
	echo " ";
	//echo $content;
    //var_dump($res);